<?php
require_once "../database/mysql.class.php";
//DAO对象，对数据库操作
//对应用户表，用户的增删改查

class gamermanagerdao{

	private $db;

	public function __construct(){
		$this->db=new mysql();
	}
	
	public function Chaxun($gamerid=null){	
		if (!isset($gamerid)){
			$sql="select id ,uname ,pwd ,ulevel ,vip,price,state,locking from users;";
			return $this->db->query($sql);
		}
		else if (isset($gamerid)){
			$sql="select id ,uname ,pwd ,ulevel ,vip,price,state,locking from users where uname like '{$gamerid}%' or id like '{$gamerid}%' ;";
		    return $this->db->query($sql);
		}
		else {
			
		}
	}
	public function Chaxun2($jieid,$suoid){
		if (isset($suoid)){
			$sql="UPDATE users  SET state='不可用',locking='解锁' WHERE id=".$suoid.";";
			return $this->db->update($sql);
		}
		else if (isset($jieid)){
			$sql="UPDATE users  SET state='可用',locking='锁定' WHERE id=".$jieid.";";
			return $this->db->update($sql);
		}
		else {
				
		}
	}
}
?>